<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getNaveMenu();
                $user=pdo_get('users',array('username'=>$_W['username']));
                $uniacid=pdo_get('users_permission',array('uid'=>$user['uid']));
$admin = pdo_get('zh_yjm_store',array('admin'=>$user['username']));
$project = pdo_fetchall("SELECT * FROM " . tablename('zh_yjm_project'). "  WHERE uniacid = ".$uniacid['uniacid']. " and store_id=".$admin['id']."   ORDER BY sort DESC");
for ($i=0; $i <count($project) ; $i++) { 
	$project[$i]['projecttypes']=pdo_get('zh_yjm_projecttype',array('id'=>$project[$i]['projecttype_id']));
	$project[$i]['projecttype']=$project[$i]['projecttypes']['title'];
}
$op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
if($op=='delete'){
	$res=pdo_delete('zh_yjm_project',array('id'=>$_GPC['id']));
	// var_dump($res);die;
	if($res){
	  message('删除成功',$this->createWebUrl2('project',array()),'success');
	}else{
	  message('删除失败','','error');
	}
}
if($_GPC['op']=='hoty'){
	$res=pdo_update('zh_yjm_project',array('state'=>0),array('id'=>$_GPC['id']));
	if($res){
     message('', 'referer', 'success');
		// iajax('200','成功',$this->createWebUrl2('activeproject'), 'ajax', false);
    }else{
          message('失败！','','error');
    }
}
if($_GPC['op']=='hotx'){
	$res=pdo_update('zh_yjm_project',array('state'=>1),array('id'=>$_GPC['id']));
	if($res){
     message('', 'referer', 'success');
    }else{
          message('失败！','','error');
    }
}
include $this->template('web/project');